#!/bin/bash

# LoongArch CI 专用测试脚本

# 1. 内核启动测试
qemu-system-loongarch64 -m 4G -smp 4 \
  -kernel out/loongarch_pc/packages/phone/images/Image \
  -initrd out/loongarch_pc/packages/phone/images/rootfs.cpio \
  -append "console=ttyS0 init=/init" \
  -nographic > boot.log 2>&1
  
# 验证内核启动成功
grep -q "OHOS LOONGARCH" boot.log || exit 1

# 2. 驱动基础测试
hdc_loongarch test -p com.ohos.drivertest -s unittest

# 3. 性能基准测试
./test/loongarch_cts/run_perf_tests.sh --target loongarch64

# 4. 系统稳定性测试
./test/stress/system_stress_test.py --arch loongarch64 --duration 24h
